package com.itboye.textileexpres.widget;

import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.TextView;

import com.itboye.textileexpes.beans.GoodsDetailBean;
import com.itboye.textileexpres.R;
import com.itboye.textileexpres.util.BaseDialogFragment;
//product_attr
public class DertailServiceDialog extends BaseDialogFragment {
	TextView has_7day, has_3day, has_xinjin, tt, has_xinyong, has_huodaofukuan,
			has_37, has_hunpi, has_tejia, has_tuijian, ok, has_7day_2;
	Context context;
	GoodsDetailBean detailBean;

	public DertailServiceDialog(Context context, GoodsDetailBean detailBean) {
		// TODO Auto-generated constructor stub
		this.context = context;
		this.detailBean = detailBean;
	}

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		View view = LayoutInflater.from(context).inflate(
				R.layout.dialog_detail_service, null);
		has_37 = (TextView) view.findViewById(R.id.has_37);
		has_7day = (TextView) view.findViewById(R.id.has_7day);
		has_3day = (TextView) view.findViewById(R.id.has_3day);
		has_xinjin = (TextView) view.findViewById(R.id.has_xinjin);
		tt = (TextView) view.findViewById(R.id.tt);
		has_xinyong = (TextView) view.findViewById(R.id.has_xinyong);
		has_huodaofukuan = (TextView) view.findViewById(R.id.has_huodaofukuan);
		has_hunpi = (TextView) view.findViewById(R.id.has_hunpi);
		has_tejia = (TextView) view.findViewById(R.id.has_tejia);
		has_tuijian = (TextView) view.findViewById(R.id.has_tuijian);
		ok = (TextView) view.findViewById(R.id.ok);
		has_7day_2 = (TextView) view.findViewById(R.id.has_7day_2);
		return view;
	}

	@Override
	public void onActivityCreated(Bundle savedInstanceState) {
		super.onActivityCreated(savedInstanceState);
		if ("1".equals(detailBean.getCan_mixed_batch())) {
			has_hunpi.setVisibility(View.VISIBLE);
		}
		if ("1".equals(detailBean.getSupport_replace())) {
			has_7day.setVisibility(View.VISIBLE);
			has_7day_2.setVisibility(View.VISIBLE);
		}
		if ("1".equals(detailBean.getConsignment_time())) {
			has_3day.setVisibility(View.VISIBLE);
		}
		if ("1".equals(detailBean.getHas_receipt())) {
			has_xinjin.setVisibility(View.VISIBLE);
		}
		if ("1".equals(detailBean.getHas_sample())) {
			tt.setVisibility(View.VISIBLE);
		}
		// if ("1".equals(detailBean.getOnshelf())) {
		// has_xinyong.setVisibility(View.VISIBLE);
		// }
		if ("1".equals(detailBean.getUnder_guaranty())) {
			has_huodaofukuan.setVisibility(View.VISIBLE);
		}
		ok.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				dismiss();
			}
		});
	}

}
